package Demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-22
 * Time: 16:25
 */
class val{
    public int val;
}
public class Test1 {
    public static void swap(val a,val b){
        int tmp = a.val;
        a.val = b.val;
        b.val = tmp;
    }
    public static void main(String[] args) {
        val a = new val();
        val b = new val();
        a.val = 10;
        b.val = 20;
        System.out.println("交换前：" + a.val + " " + b.val);
        swap(a,b);
        System.out.println("交换后：" + a.val + " " + b.val);
    }
}
